#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
const ll N = 1e5 + 10;
ll a[N];
int main()
{
    ll t;
    cin >> t;
    while (t--)
    {
        map<int, int> mp;
        ll n;
        cin >> n;
        ll count = 0;
        vector<int> b;
        set<ll> c;
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i];
            mp[a[i]]++;
        }
        if (mp.size() == 2 && (mp.begin()->second * 2 == n))
        {
            yes;
        }
        else
        {
            no;
        }
    }
}